package XYC;

import static org.junit.Assert.assertEquals;
import org.junit.Test;
/**
 * Test the functionality for method normalizeHeading in RoboCodeUtil.
 * @author Yichi Xu.
 * */
public class TestMethodNormalizeHeading {

  /**
   * Test the functionality for method normalizeHeading in RoboCodeUtil
   * Make sure normalized heading for 1 degree is 1 degree.
   * Make sure normalized heading for 181 degree is -179 degree.
   * Make sure normalized heading for -182 degree is 178 degree.
   */
  @Test
  public void testNormalizeHeading() {
    double heading1 = 1;
    double heading2 = 181;
    double heading3 = -182;
    assertEquals("Check the result for 1", RoboCodeUtil.normalizeHeading(heading1), 1, 0.01);
    assertEquals("Check the result for 181", RoboCodeUtil.normalizeHeading(heading2), -179, 0.01);
    assertEquals("Check the result for -182", RoboCodeUtil.normalizeHeading(heading3), 178, 0.01);
  }
}
